package com.yupi.yupicturebackend.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yupi.yupicturebackend.model.entity.User;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yupi.yupicturebackend.model.req.user.UserQueryRequest;
import com.yupi.yupicturebackend.model.vo.LoginUserVO;
import com.yupi.yupicturebackend.model.vo.UserVO;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
* @author 小新
* @description 针对表【user(用户)】的数据库操作Service
* @createDate 2025-03-28 14:01:53
*/
public interface UserService extends IService<User> {
   /**
    * 用户注册
    * @param userAccount
    * @param userPassword
    * @param checkPassword
    * @return
    */
   Long UserRegister(String userAccount, String userPassword,String checkPassword);


   /**
    * 用户登录
    * @param userAccount
    * @param userPassword
    * @return
    */
   LoginUserVO UserLogin(String userAccount, String userPassword, HttpServletRequest request);


   /**
    * 用户注销
    */
   boolean UserLogout(HttpServletRequest request);


   /**
    *  密码加密
    * @param password
    * @return
    */
   String getEncryptPassword(String password);


   /**
    * 获取脱敏的已登录用户信息
    * @return
    */
   LoginUserVO getLoginUserVO(User user);

   /**
    * 获取脱敏的用户信息
    * @return
    */
   UserVO getUserVO(User user);

   /**
    * 获取脱敏的用户信息列表
    * @return
    */
   List<UserVO> getUserVoList(List<User> userList);


   /**
    * 获取当前登录用户
    * @param request
    * @return
    */
   User getLoginUser(HttpServletRequest request);

   /**
    * 获取查询封装
    * @param userQueryRequest
    * @return
    */
   QueryWrapper<User> getQueryWrapper(UserQueryRequest userQueryRequest);

   /**
    * 判断当前用户是否为管理员
    * @param loginUser
    * @return
    */
   boolean isAdmin(User loginUser);
}
